<div class="container col-thin" ng-init="loginUser = '<{$Think.session.loginUser}>'" ng-controller="taskController">
    <div class="row">
        <div class="col-xs-10 col-task">
            <h4>{{ mission.mission_name }}</h4>
            <span class="tag-task" ng-class="{true: 'tag-mission-done', false: 'tag-mission-undone'}[mission.status == 2]"></span>
            <span class="text-tips">{{ getTimePast(mission.publish_time) }}</span>
            <input type="hidden" id="missionId" value="<{$mission_id}>">
        </div>
        <div class="col-xs-2 col-thin center" ng-switch="hasFavored">
            <span class="icon-fav" ng-switch-when="1" ng-click="favMission()">收藏</span>
            <span class="icon-fav-del" ng-switch-when="2" ng-click="delFavMission()">取消收藏</span>

        </div>
    </div>
    <div class="row wrap-col-cont">
        <div class="col-xs-6 right">
            <empty name="Think.session.loginUser">
                <button class="btn btn-main-short" disabled>一键接活</button>
                <else />
                <span ng-switch="mission.isReceiveMission">
                    <button ng-switch-when="1" class="btn btn-main-short" data-toggle="modal" ng-click="showModal()" ng-disabled="mission.is_self == 2">一键接活</button>
                    <button ng-switch-when="2" class="btn btn-main-short" disabled>已申请</button>
                    <button ng-switch-when="3" class="btn btn-main-short" disabled>已接活</button>
                    <button ng-switch-default class="btn btn-main-short" disabled>已结束</button>
                </span>
            </empty>
        </div>
        <div class="col-xs-6 left">
            <button class="btn btn-main-short" ng-click="getPhone()"
                    ng-disabled="mission.isphone_public != 2 || loginUser == ''">电话联系</button>
        </div>
    </div>

    <!-- Task description -->
    <div class="row">
        <div class="col-xs-12">
            <dl class="dl-horizontal-single">
                <dt>岗位需求：</dt>
                <dd class="dd-jobs">{{ mission.jobs }}&nbsp;</dd>
                <dt>工作时限：</dt>
                <dd>{{ mission.durationMeaning }}&nbsp;</dd>
                <dt>薪酬范围：</dt>
                <dd>{{ mission.salaryMeaning }}&nbsp;</dd>
                <dt>工作地点：</dt>
                <dd>{{ mission.locationMeaning }}&nbsp;</dd>
                <dt>详细描述：</dt>
                <dd class="dd-jobs">{{ mission.description }}&nbsp;</dd>
            </dl>
        </div>
    </div>
    <div class="row">
        <div class="col-xs-12 center">
            <h5 class="text-tips">任务可分享到朋友圈，让更多人知道~</h5>
        </div>
    </div>

    <!-- Publisher info -->
    <div class="row">
        <div class="col-xs-12 col-panel-resume">
            <h5>发布者</h5>
        </div>
    </div>
    <empty name="Think.session.loginUser">
        <div class="col-xs-12 col-header center">
            <p>查看联系方式请<a href="<{:U('Login/index')}>">&nbsp;登 陆&nbsp;</a>或<a href="<{:U('Register/index')}>">&nbsp;注 册</a></p>
            </p>
        </div>
        <else />
        <div class="row col-user-info col-publisher">
            <div class="col-xs-10">
                <a href="<{:U('FetcherInfo/index')}>/user_id/{{ mission.publisher_id }}">
                    <img ng-src="__UPLOAD__/{{ publisher.image_url }}" width="50px" height="50px">
                    <span class="text-name">{{ mission.publisher_name }}</span>
                </a>
                <span ng-show="publisher.trust == 2" class="tag-credit">信</span>
                <span class="tag-level-first">甲.V{{ publisher.level_j }}</span>
                <span class="tag-level-second">乙.V{{ publisher.level_y }}</span>
            </div>
            <div class="col-xs-2">
                <a href="<{:U('Message/sendOrReceiveMessage')}>/publisher_id/{{ mission.publisher_id }}/publisher_name/{{ mission.publisher_name }}">
                    <span class="icon-msg-green">留言</span>
                </a>
            </div>
        </div>
        <div class="row">
            <div class="col-xs-12 wrap-col-cont">
                <dl class="dl-horizontal-single">
                    <dt>公司名称：</dt>
                    <dd>{{ publisher.agent_j }}&nbsp;</dd>
                    <dt>公司简介：</dt>
                    <dd class="dd-jobs">{{ publisher.agent_j_desc }}&nbsp;</dd>
                </dl>
            </div>
        </div>
    </empty>

    <div class="container-task" ng-switch="mission.is_self">
        <div ng-switch-when="2">
            <!-- Followers and receivers -->
            <div ng-show="mission.receive">
                <div class="row">
                    <div class="col-xs-12 col-panel-resume">
                        <h5 class="text-receiver">已选的乙方</h5>
                    </div>
                </div>
                <div class="row">
                    <div class="col-xs-12 wrap-col-cont">
                        <div class="row">
                            <div class="col-xs-12 col-thin">
                                <ul class="ul-float ul-user">
                                    <li ng-repeat="user in mission.receive">
                                        <a href="<{:U('FetcherInfo/index')}>/user_id/{{ user.follower_id }}">
                                            <img ng-src="__UPLOAD__/{{ user.image_url }}" width="45px" height="45px">
                                            <p class="text-name">
                                                {{ user.user_name }}
                                            </p>
                                        </a>
                                    </li>
                                </ul>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

            <div ng-show="mission.follow">
                <div class="row">
                    <div class="col-xs-12 col-panel-resume">
                        <h5>申请的乙方</h5>
                    </div>
                </div>
                <div class="row">
                    <div class="col-xs-12 wrap-col-cont">
                        <div class="row">
                            <div class="col-xs-12 col-thin">
                                <ul class="ul-float ul-user">
                                    <li ng-repeat="user in mission.follow">
                                        <a href="<{:U('FetcherInfo/index')}>/user_id/{{ user.follower_id }}">
                                            <img ng-src="__UPLOAD__/{{ user.image_url }}" width="45px" height="45px">
                                            <p class="text-name">
                                                {{ user.user_name }}
                                            </p>
                                        </a>
                                    </li>
                                </ul>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

            <div class="center wrap-col-head">
                <a href="<{:U('Manage/detail')}>/mission/{{ mission.mission_id }}" role="button" class="btn btn-main">管理</a>
            </div>
        </div>
    </div>

    <!-- Modal Receive Message -->
    <div class="modal fade" id="msgModal" tabindex="-1" role="dialog" aria-labelledby="msgModalLabel" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                    <h4 class="modal-title" id="msgModalLabel"></h4>
                </div>
                <div class="modal-body">
                    <h6 class="text-tips">留言后可到消息查看历史记录</h6>
                    <textarea rows="4" id="content" class="form-control" placeholder="150字以内"></textarea>
                    <h6 class="text-tips">申请接活后，您的简历信息及联系电话将对该甲方公开。</h6>
                </div>
                <div class="modal-footer center">
                    <button type="button" id="modalSubmit" class="btn btn-main">发送</button>
                </div>
            </div>
        </div>
    </div>

    <!-- Modal Phone Number -->
    <div class="modal fade" id="contactModal" tabindex="-1" role="dialog" aria-labelledby="contactModalLabel" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <!--<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>-->
                    <!--<h4 class="modal-title" id="contactModalLabel"></h4>-->
                </div>
                <div class="modal-body center">
                    <a id="phone" ng-href="tel:{{ phone }}" class="text-name">{{ phone }}</a>
                </div>
            </div>
        </div>
    </div>
</div>

<script src="__MOBILE__/js/jweixin-1.0.0.js"></script>
<script>
//    wx.config({
//        debug: true, // 开启调试模式,调用的所有api的返回值会在客户端alert出来，若要查看传入的参数，可以在pc端打开，参数信息会通过log打出，仅在pc端时才会打印。
//        appId: '', // 必填，公众号的唯一标识
//        timestamp: '', // 必填，生成签名的时间戳
//        nonceStr: '', // 必填，生成签名的随机串
//        signature: '',// 必填，签名，见附录1
//        jsApiList: [] // 必填，需要使用的JS接口列表，所有JS接口列表见附录2
//    });
//
//    wx.ready(function(){
//        wx.onMenuShareTimeline({
//            title: '12', // 分享标题
//            link: '3131', // 分享链接
//            imgUrl: '123', // 分享图标
//            success: function () {
//                // 用户确认分享后执行的回调函数
//            },
//            cancel: function () {
//                // 用户取消分享后执行的回调函数
//            }
//        });
//    });
</script>